// 文本溢出省略号
@mixin text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

// 多行文本溢出省略号
@mixin multi-ellipsis($line: 2) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: $line;
  overflow: hidden;
}

// flex布局
@mixin flex($direction: row, $justify: flex-start, $align: center) {
  display: flex;
  flex-direction: $direction;
  justify-content: $justify;
  align-items: $align;
}

// 绝对定位居中
@mixin absolute-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

// 清除浮动
@mixin clearfix {
  &::after {
    content: '';
    display: table;
    clear: both;
  }
}

// 1px边框
@mixin border-1px($color: $border-color, $direction: all) {
  position: relative;
  &::after {
    content: '';
    position: absolute;
    background-color: $color;
    @if $direction == all {
      width: 200%;
      height: 200%;
      transform: scale(0.5);
      transform-origin: left top;
      border: 1px solid $color;
    } @else {
      @if $direction == top {
        left: 0;
        top: 0;
        width: 100%;
        height: 1px;
        transform: scaleY(0.5);
      }
      @if $direction == bottom {
        left: 0;
        bottom: 0;
        width: 100%;
        height: 1px;
        transform: scaleY(0.5);
      }
      @if $direction == left {
        left: 0;
        top: 0;
        width: 1px;
        height: 100%;
        transform: scaleX(0.5);
      }
      @if $direction == right {
        right: 0;
        top: 0;
        width: 1px;
        height: 100%;
        transform: scaleX(0.5);
      }
    }
  }
} 